package com.ruoyi.common.service.impl;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.TicketCode;
import com.ruoyi.common.utils.CommonUtil;
import com.ruoyi.system.mapper.TicketCodeMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 权益码表 服务实现类
 * </p>
 *
 * @author Lbb
 * @since 2024-12-06
 *
 */
@Service
public class TicketCodeServiceImpl {

    @Resource
    TicketCodeMapper baseMapper;

    /** 查询被保险人的券列表 */
    public ResultMsg getUserTicketCodeList(String companyType, SysUser user) {
        // 查询被保险人的券列表
        List<TicketCode> ticketList = baseMapper.getUserTicketCodeList(user.getEmail(), user.getPhonenumber(), companyType);
        if (ticketList.isEmpty()) {
            return ResultMsg.success(ticketList);
        }
        ResultMsg resultMsg=ResultMsg.success(ticketList);
        // 脱敏
//        for(TicketCode code : ticketList) {
//            code.setTicketName(CommonUtil.nameDesensitization(code.getTicketName()));
//        }
        return resultMsg;
    }
}
